package com.alan.product.issue.enums;

import com.alan.product.issue.entity.Order;

public enum StatusEnum implements MyEnum {

    UNSTART(0, "未开始"), STARTED(1, "已开始");

    private Integer code;
    private String desc;

    StatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getDesc() {
        return this.desc;
    }

    public static StatusEnum parse(Integer code) {
        if (code != null) {
            for (StatusEnum value : values()) {
                if (value.getCode().equals(code)) {
                    return value;
                }
            }
        }
        return null;
    }

    public static void main(String[] args) {
        Order order = new Order();
        StatusEnum statusEnum = StatusEnum.parse(order.getStatus());
        System.out.println(statusEnum);
    }
}
